package com.threeday;

import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
           //int[] ages=new int[5];
           int[] ages={1,2,4};
           /*Java考试结束后，老师给张浩分配了一项任务，
              让他计算全班（30人）Java课程考试的平均分
            */
          //int[] cj = new int[30];
          //int[] cj = {};
          double[] cj = new double[5];
          Scanner scanner = new Scanner(System.in);
          System.out.println("开始录入"+(cj.length)+"成绩");
          for (int i=0;i<cj.length;i++){
              System.out.print("请输入第"+(i+1)+"们课程的成绩\t\t");
              double v = scanner.nextDouble();
              //怎么操作数组-->下标
              //增-->下标
              cj[i]=v;//精度丢失
          }
          //查-->下标
          double countSum=0;  //自动类型转换
          for (int j=0;j<cj.length;j++){
              countSum+=cj[j];//countSum=countSum+cj[j]
          }
         System.out.println("这是5门成绩的平均分："+(countSum/(cj.length)));

    }
}
